//
//  ZYLabelAttributedString.m
//  labelAttrbuitTest
//
//  Created by 郭树清 on 2018/6/2.
//  Copyright © 2018年 KuoShuChing. All rights reserved.
//

#import "ZYLabelAttributedString.h"
#include <UIKit/UIKit.h>

@implementation ZYLabelAttributedString



+(NSMutableAttributedString*)changeLabelWithText:(NSArray*)textArray addAattributesAboutFont:(NSArray*)fontArray withAboutColor:(NSArray*)colorArray{
   
    NSString *textStr = [textArray componentsJoinedByString:@","];
    NSString *strUrl = [textStr stringByReplacingOccurrencesOfString:@"," withString:@""];
     NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:strUrl];
    if (textArray.count ==fontArray.count ||fontArray.count ==colorArray.count) {
        NSInteger strLocation = 0;
        for (int i=0; i<textArray.count; i++) {
            UIFont *font = [UIFont systemFontOfSize:[fontArray[i] floatValue]];
            NSString *str = textArray[i];
            
            [attrString addAttribute:NSFontAttributeName value:font range:NSMakeRange(strLocation,str.length)];
//            [attrString addAttribute:NSForegroundColorAttributeName value:[UIColor hexStringToColor:colorArray[i]] range:NSMakeRange(strLocation,str.length)];
           
                strLocation = strLocation+str.length;
          
            
        }
    }
    return attrString;
}

+ (NSMutableAttributedString *)textInput:(NSString *)inputStr{
    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:inputStr attributes:attribtDic];
    return attribtStr;
}

@end
